//
//  XNDLocationManager.h
//  CityBao
//
//  Created by YueWen on 16/9/1.
//  Copyright © 2016年 wangpj. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>


NS_ASSUME_NONNULL_BEGIN

//更新当前定位位置
typedef void(^UpdateLocationBlock)(CLLocation * location);
typedef void(^UpdateFailtureBlock)(NSString * error);

//地理反编译
typedef void(^ReverseGeocodeSuccessBlock)(NSString * locationtitle,NSDictionary * info);


@interface QDLocationManager : NSObject

/** 更新当地位置，成功回调位置，失败返回原因 */
- (void)updateLocationComplete:(UpdateLocationBlock)locationCompleteBlock
                 failtureBlock:(UpdateFailtureBlock)failtureBlockHandle;


/** 地理反编译，成功返回当前位置字符串 */
- (void)reverseGeocodeLocation:(CLLocation *)location
                      Complete:(ReverseGeocodeSuccessBlock)successBlockHandle
                      Failture:(UpdateFailtureBlock)failtureBlock;

@end



@interface QDLocationManager (RITL_ViewController)


/// 定位拒绝的回调
@property (nonatomic, copy, nullable)dispatch_block_t forbidLocalHandler;


/**
 *  检测当前应用的地理权限
 *
 *  @param viewController  当前的控制器
 *  @param requestTitle    请求的文字标题,默认为"请打开系统设置中“隐私→定位服务”，允许“XX”使用您的位置。"
 *  @param authorizedBlock 权限获取成功的标题
 */
- (void)checkLocationStatusWithViewController:(UIViewController *)viewController title:(nullable NSString *)requestTitle authorizeBlock:(void(^)(void))authorizedBlock NS_AVAILABLE_IOS(8_0);


@end




/// 定位成功结束后取出的数据
@interface QDLocationManager (XNDlocation)

/// 是否开启定位
+ (BOOL)hasLocationStatus;

/// 定位的字典
+ (nullable NSDictionary *)localInfo;

/// 省份
+ (nullable NSString *)province;

/// 城市
+ (nullable NSString *)city;

/// 街
+ (nullable NSString *)street;

/// 区
+ (nullable NSString *)subLocality;

/// 街道名字
+ (nullable NSString *)name;

/// 大道
+ (nullable NSString *)thoroughfare;

/// 经度,默认120
+ (NSNumber *)longitude;

/// 纬度,默认为36
+ (NSNumber *)latitude;

@end


NS_ASSUME_NONNULL_END


